<template>
	<view>
		<view class="tips u-flex-col" v-if="footPrint.length == 0">
			<image src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-weitao/af52b100-abaf-11ea-9e8b-05a3242b26f2.png"></image>
			<view class="text">
				目前没有足迹哦~
			</view>
			<view class="btn" @click="goHome">
				去首页逛逛
			</view>
		</view>
		<view class="goodslist-list" v-else>
			<view class="item u-flex" v-for="(item, index) in goodsList" :key="index" @click="goToDetail(item.gid)">
				<u-lazy-load
					class="goods-img"
					border-radius="12"
					:image="item.img800s || item.imgSquare"
					loading-img="/static/lazy/goods-lazy-load.png"
				></u-lazy-load>
				<view class="content u-flex-col">
					<view class="title u-line-1">{{ item.name }}</view>
					<view class="subtitle u-line-2">{{ item.summary }}</view>
					<view class="labelbox" v-if="item.labels.length!=0">
						<text v-for="(litem, lindex) in item.labels" :key="lindex" >{{ litem.text }}</text>
					</view>
					<view class="price">
						<text>￥</text>
						<text class="priceMin">{{ item.priceMin / 100 }}</text>
						<text class="spec" v-if="item.priceTag">起</text>
						<text class="marketPrice" v-if="item.priceMin != item.marketPrice">￥{{ item.marketPrice / 100 }}</text>
					</view>
				</view>
			</view>
		</view>
		<full-loading :show="fullLoading"></full-loading>
	</view>
</template>

<script>
import fullLoading from '@/components/full-loading.vue'
export default {
	data() {
		return {
			goodsList: [],
			fullLoading:false
		}
	},
	onLoad() {
		if (this.footPrint.length != 0) {
			this.fullLoading = true
			this.getGoodsList()
		}
	},
	methods: {
		getGoodsList() {
			this.$u.api.queryByGids(this.footPrint).then(res => {
				this.goodsList = res.data
				this.fullLoading = false
			})
		},
		goToDetail(gid){
			uni.navigateTo({
				url:'../../shop/goods/detail/detail?gid=' + gid
			})
		},
		goHome(){
			uni.switchTab({
				url:'../../tabbar/index/index'
			})
		}
	},
	components:{
		fullLoading
	}
}
</script>

<style lang="scss">
page{
	// background-color: #f7f7f7;
}
.goodslist-list {
	padding: 0 20rpx;
	// margin-top: 140rpx;
	background-color: #fff;
	border-radius: 24rpx 24rpx 0 0;
	overflow: hidden;
	.item {
		margin: 30rpx 0;
		font-size: 28rpx;
		.goods-img {
			width: 252rpx;
			height: 252rpx;
			.u-wrap {
				background-color: rgba(0, 0, 0, 0.02) !important;
			}
		}
		.content {
			height: 252rpx;
			padding: 4rpx 0 2rpx 16rpx;
		}

		.title,
		.subtitle {
			width: 440rpx;
		}
		.title {
			font-size: 28rpx;
			color: #333;
			line-height: 42rpx;
		}
		.subtitle {
			font-size: 24rpx;
			color: rgb(153, 153, 153);
			margin-top: 4rpx;
			line-height: 36rpx;
		}
		.selling-point {
			text {
				display: inline-block;
				margin-right: 8rpx;
				padding: 0 12rpx;
				font-size: 22rpx;
				color: #999;
				border-radius: 36rpx;
				background-color: rgb(248, 248, 248);
			}
		}
		.price {
			margin-top: auto;
			color: rgb(227, 13, 13);
			font-size: 26rpx;
			height: 40rpx;
			font-family: 'AllAndNone';
			.priceMin {
				font-size: 34rpx;
				margin-right: 4rpx;
				font-weight: bold;
			}
			.marketPrice {
				margin-left: 6rpx;
				font-size: 24rpx;
				color: #999;
				text-decoration: line-through;
			}
			.spec {
				font-size: 24rpx;
			}
		}
		.labelbox {
			margin-top: 6rpx;
			text {
				display: inline-block;
				margin-right: 10rpx;
				padding: 0 10rpx;
				height: 32rpx;
				border-radius: 4rpx;
				text-align: center;
				color: #ffffff;
				background-color: #D96B6C;
				line-height: 32rpx;
				font-size: 24rpx;
			}
		}
		.comment {
			margin-top: 6rpx;
			font-size: 22rpx;
			color: #999;
			text {
				margin-right: 12rpx;
			}
		}
	}
}
.tips {
	align-items: center;
	margin-top: 200rpx;
	image{
		width: 180rpx;
		height: 180rpx;
	}
	.text {
		font-size: 24rpx;
		color: #666;
		margin-top: 20rpx;
	}
	.btn {
		font-size: 28rpx;
		margin-top: 40rpx;
		height: 62rpx;
		width: 196rpx;
		line-height: 62rpx;
		text-align: center;
		border-radius: 31rpx;
		background-color: #fff;
		border: 1.5rpx solid #a1a1a1;
	}
}
</style>
